/*
 * HCIApp.java
 */

package hci;

import org.jdesktop.application.Application;
import java.net.URL;
import java.net.URLConnection;
import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.io.IOException;
import org.jdesktop.application.SingleFrameApplication;

import backend.*;
import org.jdesktop.application.ApplicationContext;

/**
 * The main class of the application.
 */
public class HCIApp extends SingleFrameApplication {

    public ApplicationContext ctxt;
    /**
     * At startup create and show the main frame of the application.
     */
    @Override protected void startup() {
        ApplicationContext ctxt = getContext();
        this.ctxt=ctxt;
        show(new HCIView(this));
    }


    /**
     * This method is to initialize the specified window by injecting resources.
     * Windows shown in our application come fully initialized from the GUI
     * builder, so this additional configuration is not needed.
     */
    @Override protected void configureWindow(java.awt.Window root) {
    }

    /**
     * A convenient static getter for the application instance.
     * @return the instance of HCIApp
     */
    public static HCIApp getApplication() {
        return Application.getInstance(HCIApp.class);
    }

    /**
     * Main method launching the application.
     */
    public static void main(String[] args) {
        Languages in = new Languages();
        in.initialize();
        Categories ca = new Categories();
        ca.initialize();
        Subcategories sub = new Subcategories();
        sub.initialize();
        ProductsCat cat = new ProductsCat();
        cat.initialize();
        ProductsSubCat subCat = new ProductsSubCat();
        subCat.initialize();
        ProductsSearch search= new ProductsSearch();
        search.initialize();
        ProductByID id = new ProductByID();
        id.initialize();

/*
        for(int i=0; i<in.getLanguages().length; i++)
                System.out.println(in.getLanguages()[i]);

        for(int i=0; i<ca.getCategories().length; i++)
                System.out.println(ca.getCategories()[i]);

        for(int i=0; i<sub.getSubcategories().length; i++)
                System.out.println(sub.getSubcategories()[i]);

        System.out.println("-------------CAT---------------------");
        for(int i=0; i<cat.getProducts().size(); i++){
                System.out.println("PRODUCTO "+i);
                System.out.println(cat.getProducts().get(i));
        }

        System.out.println("------------SUB-CAT------------------");
        for(int i=0; i<subCat.getProducts().size(); i++){
                System.out.println("PRODUCTO "+i);
                System.out.println(subCat.getProducts().get(i));
        }

        System.out.println("------------SEARCH------------------");
        for(int i=0; i<subCat.getProducts().size(); i++){
                System.out.println("PRODUCTO "+i);
                System.out.println(search.getProducts().get(i));
        }
        System.out.println("------------DETAILS------------------");
        System.out.println(id.getProduct());
*/
        launch(HCIApp.class, args);
    }
}